home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: Greatest Hits 1996 / Amiga Games: Greatest Hits 1996.iso / userbox / publicdomain / superplay-lib_dev / programmers / example_tools / listspos / listspos.c < prev    next >
C/C++ Source or Header  |  1996-05-27  |  5KB  |  156 lines

  1. /* ======================================================================== */
  2. /* = Programmname    : ListSPOs V1.5                      = */
  3. /* =                                      = */
  4. /* ======================================================================== */
  5. /* = Autor/Copyright : (c) 1994 by Andreas R. Kleinert.                   = */
  6. /* =               All rights reserved.                  = */
  7. /* ======================================================================== */
  8. /* = Funktion         : Shows available SPObjects of superplay.library.    = */
  9. /* =                                                             = */
  10. /* ======================================================================== */
  11. /* = Letztes Update  : 8.5.1994                                  = */
  12. /* =                                      = */
  13. /* ======================================================================== */
  14. /* = Bemerkungen     : Needs "superplay.library" V1+.                     = */
  15. /* =                                      = */
  16. /* ======================================================================== */
  17. /* = Compiler         : SAS/C V6.51                       = */
  18. /* =               (smakefile)                                        = */
  19. /* ======================================================================== */
  20.  
  21. #include <superplay/superplaybase.h>
  22. #include <SPObjects/SPObjectbase.h>
  23.  
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26. #include <proto/superplay.h>
  27.  
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31.  
  32.  
  33.    /* Help- and Info- Texts */
  34.  
  35. char entry1_text  [] = "\2331;32;40mListSPOs V1.5 \2330;32;40m\2333;32;40m(FREEWARE)\2330;32;40m\n(c) 1994 by Andreas Ralph Kleinert.\nAndreas R. Kleinert, Grube Hohe Grethe 23, D-57074 Siegen, Germany.\n";
  36. char entry2_text  [] = "Lists up available \42SPObjects\42 of \42superplay.library\42.\n";
  37. char entry3_text  [] = "USAGE : \2330;33;40mListSPOs\2330;31;40m\n";
  38.  
  39. char ver_text [] = "\0$VER: ListSPOs V1.5 (8.5.94)";
  40.  
  41.  
  42. /* *************************************************** */
  43. /* *                             * */
  44. /* * Error-Messages for Leave() and KF_Message()     * */
  45. /* *                             * */
  46. /* *************************************************** */
  47.  
  48. char splib_text [] = "You need \42superplay.library\42 V1+ !";
  49.  
  50.  
  51. /* *************************************************** */
  52. /* *                             * */
  53. /* * MACROs for Version-Tests                 * */
  54. /* *                             * */
  55. /* *************************************************** */
  56.  
  57. #define LibVer(x) ( ((struct Library *) x)->lib_Version )
  58. #define OS_VER      LibVer(SysBase)
  59.  
  60.  
  61. /* *************************************************** */
  62. /* *                             * */
  63. /* * Function Declarations                 * */
  64. /* *                             * */
  65. /* *************************************************** */
  66.  
  67. void __regargs Leave(char *endtext, long code);
  68.  
  69.  
  70.    /* Functions from module "ListSPOs_Subs.o" : */
  71.  
  72. extern void __stdargs SP_Printf(char *formatstring, ...);
  73.  
  74.  
  75. /* *************************************************** */
  76. /* *                             * */
  77. /* * Additional Base Declarations             * */
  78. /* *                             * */
  79. /* *************************************************** */
  80.  
  81. extern struct ExecBase *SysBase;
  82.  
  83. struct SuperPlayBase *SuperPlayBase = N;
  84.  
  85.  
  86. /* *************************************************** */
  87. /* *                             * */
  88. /* * MAIN                         * */
  89. /* *                             * */
  90. /* *************************************************** */
  91.  
  92. void main(long argc, char **argv)
  93. {
  94.  struct List           *obj_list = N;
  95.  struct SPO_ObjectNode *spo_node = N;
  96.  long i;
  97.  
  98.  if(argc==0) Leave(N, FALSE);
  99.  
  100.  if( argc > 3 || (argv[1][0] =='?')||(argv[2][0] =='?'))
  101.   {
  102.    SP_Printf("%s%s%s", entry1_text, entry2_text, entry3_text);
  103.  
  104.    Leave(N, 0);
  105.   }
  106.  
  107.  SuperPlayBase = (struct SuperPlayBase *) OpenLibrary("superplay.library", 1);
  108.  if(!SuperPlayBase) Leave(splib_text, 100);
  109.  
  110.  SP_Printf("\nList of available SPObjects :");
  111.  
  112.  obj_list = &SuperPlayBase->spb_SPObjectList;
  113.  
  114.  for(spo_node=(APTR) obj_list->lh_Head;(spo_node)&&(spo_node!=(APTR) &(obj_list->lh_Tail));)
  115.   {
  116.    SP_Printf("\n\n");
  117.  
  118.    SP_Printf("\nSPObject : \42%s\42", spo_node->spo_FileName);
  119.    SP_Printf("\nSPO-Type : %lx",      spo_node->spo_ObjectType);
  120.    SP_Printf("\nPriority : %ld",      (long) ((struct Node *)spo_node)->ln_Pri);
  121.    SP_Printf("\nTypeID   : \42%s\42", spo_node->spo_TypeID);
  122.    SP_Printf("\nTypeCode : %ld",      spo_node->spo_TypeCode);
  123.  
  124.    if(spo_node->spo_BackgroundReplay) SP_Printf("\nKind     : BackGround-Player");
  125.     else                              SP_Printf("\nKind     : Synchron-Player");
  126.  
  127.    for(i=0; i<spo_node->spo_SubTypeNum; i++)
  128.     {
  129.      SP_Printf("\n\n%ld. SubType     :", i+1);
  130.      SP_Printf("\n   SubTypeID   : \42%s\42", spo_node->spo_SubTypeID[i]);
  131.      SP_Printf("\n   SubTypeCode : %ld",      spo_node->spo_SubTypeCode[i]);
  132.     }
  133.  
  134.    spo_node = (APTR) ((struct Node *)spo_node)->ln_Succ;
  135.   }
  136.  
  137.  SP_Printf("\n\nNo more SPObjects available.\n\n");
  138.  
  139.  Leave(N, 0);
  140. }
  141.  
  142. /* *************************************************** */
  143. /* *                             * */
  144. /* * LEAVE : Global Exit Function Replacement         * */
  145. /* *                             * */
  146. /* *************************************************** */
  147.  
  148. void __regargs Leave(char *endtext, long code)
  149. {
  150.  if(SuperPlayBase) CloseLibrary((APTR) SuperPlayBase);
  151.  
  152.  if(endtext)       SP_Printf("%s\n", endtext);
  153.  
  154.  exit(code);
  155. }
  156.